<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="com.ulic.customerManApplication.constant.CONSTANT" %>
<%@ page import="com.ulic.customerManApplication.commonmodule.bo.Menu" %>
<%@ page import="com.ulic.customerManApplication.commonmodule.bo.Function" %>
<%@ page import="com.ulic.customerManApplication.commonmodule.bo.Organization" %>
<%@ page import="com.ulic.customerManApplication.commonmodule.service.OrganizationService" %>
<%@ page import="com.ulic.customerManApplication.usermodule.bo.Adminitrator" %>
<%@ page import="com.ulic.customerManApplication.usermodule.bo.User" %>
<%@ page import="com.ulic.customerManApplication.usermodule.bo.Role" %>
<%@ page import="java.util.Set" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="java.util.List" %>
<%@page import="org.springframework.web.context.ContextLoader"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="pg"  uri="http://jsptags.com/tags/navigation/pager" %>
<% 
	User loginUser = (User)request.getSession().getAttribute(CONSTANT.USER_SESSION_KEY);
	String userOid = loginUser.getUm_user_id();
	String rolename = "";
	if(loginUser!=null){
		rolename = request.getSession().getAttribute("rname").toString();
	}
	String contextPath = request.getContextPath();
%>
<% Adminitrator loginAdmin = (Adminitrator)request.getSession().getAttribute(CONSTANT.ADMIN_SESSION_KEY);%>
<% String url = request.getRequestURL().toString(); %>
<%
	OrganizationService organizationService = (OrganizationService)ContextLoader.getCurrentWebApplicationContext().getBean("organizationService");
 %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />     
<title>会员管理系统</title>
<link rel="icon" href="favicon.ico" type="image/x-icon" />
<link href="<%= request.getContextPath() %>/html/css/Main.css" rel="stylesheet" type="text/css" />
<link href="<%= request.getContextPath() %>/html/css/tree.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%= request.getContextPath() %>/html/js/PopupCalendar.js"></script>
<script type="text/javascript" src="<%= request.getContextPath() %>/html/js/prototype.js"></script>
<script type="text/javascript" src="<%= request.getContextPath() %>/html/js/buffalo.js"></script>
<script type="text/javascript" src="<%= request.getContextPath() %>/html/js/pims.js"></script>
<script type="text/javascript" src="<%= request.getContextPath() %>/html/js/xtree.js"></script>
<script type="text/javascript" src="<%= request.getContextPath() %>/html/js/xloadtree.js"></script>
<script type="text/javascript" src="<%= request.getContextPath() %>/html/js/prototype-1.4.0.js"></script>
<!-- Dwr Js -->
<script src="<%= request.getContextPath() %>/dwr/interface/organizationAction.js" type="text/javascript"></script>
<script src="<%= request.getContextPath() %>/dwr/engine.js" type="text/javascript"></script>
<script src="<%= request.getContextPath() %>/dwr/util.js" type="text/javascript"></script>
<style>
body,ul,ol,dl,dd,p,h1,h2,h3,h4,h5,h6,form,input,textarea,select,td,th{margin:0;padding:0; font-family:"宋体",Arial, Helvetica, sans-serif;}
li{ list-style:none;}
input{ background:none;}
.clear{ zoom:1;}
.clear:after{content:""; display:block; clear:both;}
</style>
<script type="text/javascript">
	var showTree = true;	
	/*--------------------------------------------------------------
		功能：初始化 载入根部门和用户
	---------------------------------------------------------------*/
	/*-------------------------------------------------------------

		功能：Tree Menu
	--------------------------------------------------------------*/
	
	function treeCurrentNode(url){
		$('leftMenu').src="<%= request.getContextPath() %>"+url;
	}
	
	function changeTreeStyle(){
		if(showTree){
			$('treeMenu').style.display="none";
			$('wp_right').style.width="99.5%";
			$('wp_lf_cter').className="wp_lf_cter1";
		}else{
			$('treeMenu').style.display="";
			$('wp_right').style.width="79%";
			$('wp_lf_cter').className="wp_lf_cter";
		}
		showTree = !showTree;
	}
		</script>
</head>

<body >
<div id="Layer" style="position:absolute;top:0;left:0;width:100%; height:850px; z-index:10;margin:0 auto;background:#000; opacity:0.6; filter:alpha(opacity:60);display:;align:center" >
</div>
<div class="container">
	<div class="header">
    	<p class="xt">会员管理系统</p>
    	<p class="hd_txt"><span style="position:absolute;top:0;left:0;">当前用户：<%= loginUser!=null?loginUser.getReal_Name():loginAdmin.getUsername()%></span><br/><span>角&nbsp;&nbsp;&nbsp;&nbsp;色：<%= loginUser!=null?rolename:"超级管理员"%></span><a href="<%= request.getContextPath() %>/um_logout" target="_top">退出</a></p>
    </div>
    <div class="top4"></div>
    <div class="wrap clear">
    	<div class="wp_left" id="treeMenu" style="overflow-x:auto;overflow-y:auto;">
				<div id="tree"></div>
         </div>
        <div class="wp_lf_cter" id="wp_lf_cter" onclick="changeTreeStyle()">
        </div>
        <div class="wp_right" id="wp_right">
             	<iframe id="leftMenu" src="jsp/main/welcome.jsp" scrolling="no" frameborder="0"></iframe>
        </div>
       
    </div>
	<div class="footer">
    	<p>Copyright Reserved,Union Life Company,Ltd</p>
    </div>
</div>
</body>
<script type="text/javascript">
	var progressBar = new ProgressBar();
	progressBar.isNeedConfirmButton = false;
	progressBar.isNeedProgressBar = true;
	progressBar.SetStatus("正在加载数据，请稍等...");
	loadTree();
	function loadTree(){
		organizationAction.getTreeHTML("-1",'<%=userOid%>','<%=contextPath%>',{
			callback:function(result){
				document.getElementById("tree").innerHTML = result;	
				progressBar.Close();
				document.getElementById("Layer").style.display="none";
			},errorHandler:function(errorString, exception) {
		      	progressBar.Close();
				document.getElementById("Layer").style.display="none";	
				alert(errorString,280,180," ",null);
				 return;
			  }
		});
	}
	function callTreeService(code){
		organizationAction.getTreeHTML(code,'<%=userOid%>','<%=contextPath%>',{
			callback:function(result){
				document.getElementById("tree").innerHTML = result;	
			},errorHandler:function(errorString, exception) {
				alert(errorString,280,180," ",null);
				 return;
			  }
		});
	}
</script>
</html>